

## Skript f�r: "Populismus versus majorit�rer Relativismus. Zu einer wichtigen Unterscheidung zwischen Demokratiekonzeptionen in der Bev�lkerung"

## Version: Mai 2022

## Autor: Pascal K�nig



#### Pakete laden ####

library(RColorBrewer)
library(psych)
library(FactoMineR)
library(factoextra)
library(lattice)
library(MASS)
library(smacof)
library(tidyr)
library(texreg)
library(dotwhisker)
library(gridExtra)
library(lavaan)
library(gridExtra)
library(Hmisc)
library(rcompanion)



#### Filter anwenden ###

df <- df[df$TE06_05 == 1, ] # Aufmerksamkeitscheck (Item in einer Batterie zu Technophobie)
df <- df[df$KO01 == "Ja, ich habe den Fragebogen aufmerksam und nach bestem Wissen und Gewissen beantwortet. Meine Angaben können zur Auswertung verwendet werden.", ] # Kontrollfrage am Ende des Fragebogens
df <- df[df$TIME_SUM >= 300, ] # Mindesens f�nf Minuten Bearbeitungszeit



#### Abh�ngige Variablen ####

# Unterst�tzung f�r KI auf hohen politischen Entscheidungsebenen

psych::alpha(df[c("PL04_05", 
                  "PL04_06") ],
             check.keys=TRUE) 

df$aisupport_replace <- (df$PL04_05 + df$PL04_06)/2

df$aisupport_replace_bin  <- NA
df$aisupport_replace_bin[df$aisupport_replace < 3]  <- 0
df$aisupport_replace_bin[df$aisupport_replace >= 3]  <- 1
table(df$aisupport_replace_bin )



# Wahlabsicht  AfD

df$voterrp <- 0
df$voterrp[ is.na(df$PL07) == T] <- NA
df$voterrp[ df$PL07 == "AfD"] <- 1
table(df$voterrp)

# Anteil Fehlend

summary(df$PL07)
57/sum( table(df$PL07) )




#### Unabh�ngige Variablen ####

#### Demokratiekonzeptionen ####

tmp <- df[ , c("DE05_01", # Populismus
               "DE05_02", # Populismus
               "DE05_03", # Populismus
               "DE05_10", # Majorit�rer Relativismus
               "DE05_11", # Majorit�rer Relativismus
               "DE05_12", # Majorit�rer Relativismus
               "DE08_05", # PLuralismus
               "DE08_06", # PLuralismus
               "DE08_07" # PLuralismus
               ) ]
tmp <- tmp[complete.cases(tmp), ]



fa.out <- factanal(tmp[c("DE05_01", # Populismus
                         "DE05_02", # Populismus
                         "DE05_03", # Populismus
                         "DE05_10", # Majorit�rer Relativismus
                         "DE05_11", # Majorit�rer Relativismus
                         "DE05_12", # Majorit�rer Relativismus
                         "DE08_05", # PLuralismus
                         "DE08_06", # PLuralismus
                         "DE08_07"  # PLuralismus

)], 
factors = 3, rotation = "promax")

fa.out$loadings
fa.out

KMO(tmp)

# write.csv(unclass(loadings(fa.out)), file = "pca.loadings.csv")


# Generieren der Variablen f�r Demokratiekonzeptionen
psych::alpha(df[c("DE05_01", 
                  "DE05_02",
                  "DE05_03") ],
             check.keys=TRUE) # Alpha is 0.81

df$populist <- apply( df[c( "DE05_01", 
                            "DE05_02",
                            "DE05_03")], 1, mean, na.rm=TRUE)

psych::alpha(df[c("DE05_10", 
                  "DE05_11",
                  "DE05_12") ],
             check.keys=TRUE) # Alpha is 0.80

df$majrel <- apply( df[c( "DE05_10", 
                            "DE05_11",
                            "DE05_12")], 1, mean, na.rm=TRUE)


psych::alpha(df[c("DE08_05",   
                  "DE08_06",
                  "DE08_07") ],
             check.keys=TRUE) # Alpha is 0.80


df$pluralist <- apply( df[c( "DE08_05",   
                             "DE08_06",
                             "DE08_07")], 1, mean, na.rm=TRUE)



# Grafiken erzeugen (Abbildung 1)

p1 <- ggplot(df, aes(x=populist)) + 
        geom_histogram(color="black", fill="white", binwidth=0.5) + 
        geom_vline(aes(xintercept= mean(df$populist, na.rm = T) ),  color="grey20", linetype="dashed", size=1) + 
        theme_bw() + ylab("Anzahl") + xlab("Populistisch") + scale_x_continuous(breaks = seq(1, 7 , by = 1))
p1

p2 <- ggplot(df, aes(x=majrel)) + 
  geom_histogram(color="black", fill="white", binwidth=0.5) + 
  geom_vline(aes(xintercept= mean(df$majrel, na.rm = T) ),  color="grey20", linetype="dashed", size=1) + 
  theme_bw() + ylab("Anzahl") + xlab("Majorit�r-relativistisch")  + scale_x_continuous(breaks = seq(1, 7 , by = 1))


p3 <- ggplot(df, aes(x=pluralist)) + 
  geom_histogram(color="black", fill="white", binwidth=0.5) + 
  geom_vline(aes(xintercept= mean(df$pluralist, na.rm = T) ),  color="grey20", linetype="dashed", size=1) + 
  theme_bw() + ylab("Anzahl") + xlab("Pluralistisch")  + scale_x_continuous(breaks = seq(1, 7 , by = 1))



# png(paste0("Figure_histograms.png"), width=12, height=12,units="cm", res=400)

grid.arrange(p1, p2, p3, 
             ncol = 1) # Abbildung 1

# dev.off()




#### Kombinationen betrachten ####

# Populismus und Pluralismus

df$puretypeA <- 0
df$puretypeA[df$populist > mean(df$populist, na.rm=T) & 
               df$pluralist < mean(df$pluralist, na.rm=T) ] <- 1
table(df$puretypeA )


df$puretypeA <- 0
df$puretypeA[df$populist > mean(df$populist, na.rm=T) & 
               df$pluralist < mean(df$pluralist, na.rm=T) &
               df$majrel < mean(df$majrel, na.rm=T)] <- 1
table(df$puretypeA )


# Politischer Nihilismus und Pluralismus

df$puretypeB <- 0
df$puretypeB[df$majrel > mean(df$majrel, na.rm=T) & 
               df$pluralist < mean(df$pluralist, na.rm=T) ] <- 1
table(df$puretypeB )


df$puretypeB <- 0
df$puretypeB[df$majrel > mean(df$majrel, na.rm=T) & 
               df$pluralist < mean(df$pluralist, na.rm=T) &
               df$populist < mean(df$populist, na.rm=T)] <- 1
table(df$puretypeB )



#### Institutionenvertrauen, Politikverdrossenheit, Selbstwirksamkeit ####

# Invertierte Items entsprechend rekodieren

df$PL06_03r <- 6-df$PL06_03
df$PL06_07r <- 6-df$PL06_07

df$PL06_06r <- 6-df$PL06_06


# Explorative Faktorenanalyse f�r Institutionenvertrauen, Politikverdrossenheit, Selbstwirksamkeit

tmp <- df[ , c("VT04_01",   
               "VT04_02",
               "VT04_03", 
               "VT04_04",
               "VT04_05",
               "PL06_01", 
               "PL06_02",
               "PL06_03r",
               "PL06_04",
               "PL06_07r",
               "PL06_05", 
               "PL06_06r") ]
df.compl <- tmp[complete.cases(tmp), ]



fa.out <- factanal( df.compl[c( "VT04_01",   
                                "VT04_02",
                                "VT04_03", 
                                "VT04_04",
                                "VT04_05",
                                "PL06_01", 
                                "PL06_02",
                                "PL06_03r",
                                "PL06_04",
                                "PL06_07r",
                                "PL06_05", 
                                "PL06_06r")], factors = 3, rotation = "varimax" # Anhang A3
)

fa.out

# write.csv(unclass(loadings(fa.out)), file = "pca_loadings_polsupport.csv")



# Politisches Vertrauen

psych::alpha(df[c("VT04_01",   
                  "VT04_02",
                  "VT04_03", 
                  "VT04_04",
                  "VT04_05") ],
             check.keys=TRUE) # Alpha is 0.92

df$poltrust <- apply( df[c( "VT04_01",   
                            "VT04_02",
                            "VT04_03", 
                            "VT04_04",
                            "VT04_05")], 1, mean, na.rm=TRUE)


# Politikverdrossenheit

psych::alpha(df[c("PL06_01", 
                  "PL06_02",
                  "PL06_03r",
                  "PL06_04",
                  "PL06_07r") ],
             check.keys=TRUE) 


df$disaffec <- apply( df[c( "PL06_01", 
                            "PL06_02",
                            "PL06_03r",
                            "PL06_04",
                            "PL06_07r")], 1, mean, na.rm=TRUE)

psych::alpha(df[c("PL06_01", 
                  "PL06_02",
                  "PL06_04",
                  "PL06_07r") ],
             check.keys=TRUE) 


df$disaffec2 <- apply( df[c( "PL06_01", 
                             "PL06_02",
                             "PL06_04",
                             "PL06_07r")], 1, mean, na.rm=TRUE) # Ohne Item3 mit Cross-Loadings in de Faktorenanalyse


# Selbstwirksamkeit

psych::alpha(df[c("PL06_05", 
                  "PL06_06r") ],
             check.keys=TRUE) 


df$efficacy <- apply( df[c( "PL06_05", 
                            "PL06_06r")], 1, mean, na.rm=TRUE)

df$efficacy <- 6 - df$efficacy


# Demokratiezufriedenheit

df$VT06_01 # demsat



#### Ambiguit�tstoleranz ####

psych::alpha(df[c("PS04_01", 
                  "PS04_02",
                  "PS04_03",
                  "PS04_04", 
                  "PS04_06",
                  "PS04_08") ],
             check.keys=TRUE) 


df$PS04_01r <- 6 - df$PS04_01 # item invertieren
df$PS04_03r <- 6 - df$PS04_03 # item invertieren


tmp <- df[ , c("PS04_01r", 
               "PS04_02",
               "PS04_03r",
               "PS04_04", 
               "PS04_06",
               "PS04_08") ]
df.compl <- tmp[complete.cases(tmp), ]


fa.out <- factanal( df.compl[c( "PS04_01r", 
                                "PS04_02",
                                "PS04_03r",
                                "PS04_04", 
                                "PS04_06",
                                "PS04_08")], factors = 2, rotation = "varimax" # Online Anhang A4
)

fa.out

df$ambitol <- apply( df[c( "PS04_01r", 
                           "PS04_02",
                           "PS04_03r",
                           "PS04_04", 
                           "PS04_06",
                           "PS04_08")], 1, mean, na.rm=TRUE)



#### Policy-Pr�ferenzen ####

df$PL01_01 # Links-Rechts
df$PL01_01 <- df$PL01_01 -4 # Zentrieren der Links-Rechts-Position (f�r sp�teres Quadrieren)

df$PL02_01  # Wirtschaft

df$PL03_01  # Immigration



#### Politisches Interesse ####

df$VT05
table(df$VT05)

df$polint <- as.numeric(df$VT05)



#### Demographie ####

# Gender

df$female <- 0
df$female[df$DG15 == "weiblich"] <- 1

# Alter

df$age

# Bildung

df$education <- 0 
df$education[df$DG03 == "Fachhochschulreife (Abschluss einer Fachoberschule etc.)"] <- 1
df$education[df$DG03 == "Abitur bzw. erweiterte Oberschule mit Abschluss 12. Klasse (Hochschulreife)"] <- 1



#### Beschreibung der unabh�ngigen Variablen (Online Anhang A5) ####

desc_1 <- psych::describe(df[c("populist",
                               "majrel",
                               "pluralist",
                               "disaffec",
                               "poltrust",
                               "efficacy",
                               "VT06_01",
                               "ambitol",
                               "PL01_01",
                               "PL02_01",
                               "PL03_01",
                               "polint",
                               "age",
                               "female",
                               "education")] 
) 

# write.csv(desc_1, "descriptives_IV.csv")





#### Korrelationen zwischen Demokratiekonzeptionen und politischer Unterst�tzung (Anhang A6) #####

tmp <- df[ c("populist",  "majrel", "pluralist", "disaffec", "poltrust", "VT06_01"
              ) ]
cor.out <- rcorr(as.matrix(tmp))

cor.out$r
cor.out
cor.out$P

cor.out$P2 <- cor.out$P
cor.out$P2[cor.out$P >= 0.05] <- ""
cor.out$P2[cor.out$P < 0.05] <- "*"
cor.out$P2[cor.out$P < 0.01] <- "**"
cor.out$P2 

# write.csv(cor.out$r, file = "cor_matrix1.csv")
# write.csv(cor.out$P2, file = "cor_matrix2.csv")



#### Regressionsmodelle: Hauptmodelle ####

m01 <- glm(voterrp ~ populist + majrel + pluralist,
          data = df, family = "binomial")
summary(m01)

m1 <- glm(voterrp ~ populist + majrel + pluralist + 
            disaffec +  poltrust + VT06_01 +  efficacy +
             PL01_01 + PL02_01 + PL03_01 + ambitol + polint + age + female + education,
           data = df, family = "binomial")
summary(m1)



m02 <- glm(aisupport_replace_bin ~ populist +  majrel + pluralist,
          data = df, family = "binomial")
summary(m02)

m2 <- glm(aisupport_replace_bin ~ populist +  majrel + pluralist + 
            disaffec +  poltrust + VT06_01 +  efficacy +
             PL01_01 + PL02_01 + PL03_01 + ambitol + polint + age + female + education,
           data = df, family = "binomial")
summary(m2)


nagelkerke(m01)
nagelkerke(m1)
nagelkerke(m02)
nagelkerke(m2)

# wordreg( list(m01, m1, m02, m2), file = "Main_models.doc") # Tabelle 2



#### Analyse der Multikollinearit�t (Anhang A7) ####

car::vif(m1)
car::vif(m2)



#### Weitere Modelle: AfD und Linke als 1 kodiert (Anhang A8) ####

df$votepop2 <- 0
df$votepop2[ is.na(df$PL07) == T] <- NA
df$votepop2[ df$PL07 == "AfD"] <- 1
df$votepop2[ df$PL07 == "Die Linke"] <- 1
table(df$votepop2)


m_left1a <- glm(votepop2 ~ populist + majrel + pluralist,
               data = df, family = "binomial")
summary(m_left1a)


m_left1b <- glm(votepop2 ~ populist + majrel + pluralist + 
                  disaffec +  poltrust + VT06_01 +  efficacy +
                  PL01_01 + I(PL01_01^2) + PL02_01 + PL03_01 + ambitol + polint + age + female + education,
                data = df, family = "binomial")
summary(m_left1b)



#### Weitere Modelle: AfD als 1 und Linke als missing (Anhang A8) ####

df$votepop3 <- 0
df$votepop3[ is.na(df$PL07) == T] <- NA
df$votepop3[ df$PL07 == "AfD"] <- 1
df$votepop3[ df$PL07 == "Die Linke"] <- NA
table(df$votepop3)


m_left2a <- glm(votepop3 ~ populist + majrel + pluralist,
               data = df, family = "binomial")
summary(m_left2a)


m_left2b <- glm(votepop3 ~ populist + majrel + pluralist + 
                 disaffec +  poltrust + VT06_01 +  efficacy +
                 PL01_01 + PL02_01 + PL03_01 + ambitol + polint + age + female + education,
               data = df, family = "binomial")
summary(m_left2b)



# wordreg( list(m_left1a, m_left1b, m_left2a, m_left2b),   file = "Regressions_mc_left.doc")


nagelkerke(m_left1a)
nagelkerke(m_left1b)
nagelkerke(m_left2a)
nagelkerke(m_left2b)



#### Weitere Modelle: Wahlabsicht Linkspartei (Anhang A9) ####

df$voteleft1 <- 0
df$voteleft1[ is.na(df$PL07) == T] <- NA
df$voteleft1[ df$PL07 == "AfD"] <- 0
df$voteleft1[ df$PL07 == "Die Linke"] <- 1
table(df$voteleft1)

m_left1a <- glm(voteleft1 ~ populist + majrel + pluralist + 
                  disaffec +  poltrust + VT06_01 +  efficacy +
                  PL01_01 + PL02_01 + PL03_01 + ambitol + polint + age + female + education,
                data = df, family = "binomial")
summary(m_left1a)

m_left1b <- glm(voteleft1 ~ populist + majrel + pluralist + 
                  disaffec + 
                  efficacy +
                  PL01_01 + PL02_01 + PL03_01 + ambitol + polint + age + female + education,
                data = df, family = "binomial")
summary(m_left1b)




df$voteleft2 <- 0
df$voteleft2[ is.na(df$PL07) == T] <- NA
df$voteleft2[ df$PL07 == "AfD"] <- NA 
df$voteleft2[ df$PL07 == "Die Linke"] <- 1
table(df$voteleft2)


m_left1c <- glm(voteleft2 ~ populist + majrel + pluralist + 
                  disaffec +  poltrust + VT06_01 +  efficacy +
                  PL01_01 + PL02_01 + PL03_01 + ambitol + polint + age + female + education,
                data = df, family = "binomial")
summary(m_left1c)

m_left1d <- glm(voteleft2 ~ populist + majrel + pluralist + 
                  disaffec +
                  efficacy +
                  PL01_01 + PL02_01 + PL03_01 + ambitol + polint + age + female + education,
                data = df, family = "binomial")
summary(m_left1d)



# wordreg( list(m_left1a, m_left1b, m_left1c, m_left1d),   file = "Regressions_mc_left2.doc")


nagelkerke(m_left1a)
nagelkerke(m_left1b)
nagelkerke(m_left1c)
nagelkerke(m_left1d)



#### Regressionsmodelle: Alternative Variable f�r Politikverdrossenheit  (Anhang A10) ####

m1 <- glm(voterrp ~ populist + majrel + pluralist + 
            disaffec2 +  poltrust + VT06_01 +  efficacy +
            PL01_01 + PL02_01 + PL03_01 + ambitol + polint + age + female + education,
          data = df, family = "binomial")
summary(m1)


m2 <- glm(aisupport_replace_bin ~ populist +  majrel + pluralist + 
            disaffec2 +  poltrust + VT06_01 +  efficacy +
            PL01_01 + PL02_01 + PL03_01 + ambitol + polint + age + female + education,
          data = df, family = "binomial")
summary(m2)


nagelkerke(m1)
nagelkerke(m2)

# wordreg( list(m1, m2), file = "Main_models_2.doc")



